{%TEMPLATE->struct/head%}
{%TEMPLATE->struct/menu%}
<h2>Hashtypes</h2>
{%TEMPLATE->struct/messages%}
<form action="hashtypes.php" method="POST">
	<input type='hidden' name='action' value='[[$DHashtypeAction::ADD_HASHTYPE]]'>
	<input type="hidden" name="csrf" value="[[csrf]]">
	<div class="card">
    <div class="table-responsive">
      <table class="table table-bordered">
			  <tr>
				  <th colspan='4' style='text-align: center;'>
					  <b>Add new Hashtype</b>
				  </th>
			  </tr>
			  <tr>
				  <th>Hashtype (Hashcat -m)</th>
				  <th>Description</th>
				  <th>Salted (only if there is a separate salt value)</th>
          <th>Slow Hash</th>
			  </tr>
			  <tr>
				  <td>
					  <input type='text' name='id' class='form-control' title="ID">
				  </td>
				  <td>
					  <input type='text' name='description' class='form-control' title="Description">
				  </td>
				  <td>
					  <select name="isSalted" class="form-control" title="Is Salted">
              <option value="0">No</option>
              <option value="1">Yes</option>
            </select>
				  </td>
				  <td>
					  <select name="isSlowHash" class="form-control" title="Is Slow Hash">
              <option value="0">No</option>
              <option value="1">Yes</option>
            </select>
				  </td>
			  </tr>
			  <tr>
				  <td colspan="4">
					  <input type="submit" class='btn btn-success' value="Add">
				  </td>
			  </tr>
		  </table>
    </div>
	</div>
</form>
<div class="card">
  <div class="table-responsive">
    <table class="table table-bordered">
		  <tr>
			  <th>Hashtype (Hashcat -m)</th>
			  <th>Description</th>
        <th>Salted</th>
        <th>Slow Hash</th>
			  <th>&nbsp;</th>
		  </tr>
		  {{FOREACH type;[[hashtypes]]}}
			  <tr>
				  <td>[[type.getId()]]</td>
				  <td>[[type.getDescription()]]</td>
          <td>
            {{IF [[type.getIsSalted()]] == 1}}
              Yes
            {{ELSE}}
              No
            {{ENDIF}}
          </td>
          <td>
            {{IF [[type.getIsSlowHash()]] == 1}}
              Yes
            {{ELSE}}
              No
            {{ENDIF}}
          </td>
				  <td>
					  <form class="float-right" action="hashtypes.php" method="POST" onSubmit="if (!confirm('Really delete hashtype [[type.getId()]]?')) return false;">
						  <input type="hidden" name="action" value="[[$DHashtypeAction::DELETE_HASHTYPE]]">
						  <input type="hidden" name="type" value="[[type.getId()]]">
						  <input type="hidden" name="csrf" value="[[csrf]]">
              <button type="submit" class='btn btn-danger' data-toggle="tooltip" data-placement="top" title="Delete"><i class="fas fa-trash" aria-hidden="true"></i></button>
					  </form>
				  </td>
			  </tr>
		  {{ENDFOREACH}}
	  </table>
  </div>
</div>
{%TEMPLATE->struct/foot%}
